/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package TanqueAgua;

/**
 *
 * @author nazaretruiz
 */

public class TanqueAgua {
    
    //Volumen del tanque
    public int vol;
    
    //Cantidad con la que el tanque dispone al comenzar.
    public int cant;
    
    //Constructores
    public TanqueAgua(){
        this.vol=0;
        this.cant=0;
    }
    
    public TanqueAgua(int vol, int cant){
        this.vol=vol;
        this.cant=cant;
    }

    //Getters&Setters
    public int getVol() {
        return vol;
    }

    public void setVol(int vol) {
        this.vol = vol;
    }

    public int getCant() {
        return cant;
    }

    public void setCant(int cant) {
        this.cant = cant;
    }
    
    public synchronized int actualizaTanque(int cantidad){
        if(cant+cantidad>100)
            this.cant=100;
        else
            this.cant+=cantidad;
        System.out.println("Cantidad Tanque : " + this.cant);
        return this.cant;
    }
    
    public int porcentajeOcupacion(){
        return this.cant/this.vol; 
    }
    
}
